Skip to content

feat!: remove WebSocketClientTransport#1783

Open
felixweinberger wants to merge 2 commits intomainfrom
fweinberger/remove-websocket-transport
Open

feat!: remove WebSocketClientTransport#1783
felixweinberger wants to merge 2 commits intomainfrom
fweinberger/remove-websocket-transport

Conversation

@felixweinberger
Copy link
Copy Markdown
Contributor

Removes WebSocketClientTransport from the client package.

Motivation and Context

Per #142, maintainer consensus (jspahrsummers, felixweinberger, calclavia) is to remove the WebSocket transport to avoid transport proliferation. WebSocket is not a spec-defined MCP transport, and keeping it in the SDK encourages non-conformant deployments without a testing baseline.

Users who need WebSocket can implement the Transport interface directly — it remains exported from @modelcontextprotocol/client.

Closes #142.

How Has This Been Tested?

  • pnpm --filter @modelcontextprotocol/client typecheck — passes
  • pnpm --filter @modelcontextprotocol/client test — 311 tests pass
  • pnpm --filter @modelcontextprotocol/client lint — passes
  • pnpm build:all — builds cleanly
  • Pre-push hooks (build + lint + typecheck across all packages) — pass

Breaking Changes

Yes. WebSocketClientTransport is no longer exported. Users must migrate to StreamableHTTPClientTransport or StdioClientTransport, or implement a custom Transport. Migration guidance added to docs/migration.md and docs/migration-SKILL.md.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

  • Removed ws:/wss: handling from scripts/cli.ts (test CLI now supports http/https + stdio only)
  • Added changeset marking @modelcontextprotocol/client major bump

@felixweinberger felixweinberger requested a review from a team as a code owner March 27, 2026 11:37
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 27, 2026

🦋 Changeset detected

Latest commit: e1ce74a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@modelcontextprotocol/client Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 27, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1783

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1783

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1783

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1783

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1783

commit: 3baf223

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — straightforward removal with good migration docs.

Extended reasoning...

Overview

This PR removes WebSocketClientTransport from @modelcontextprotocol/client. The changes are:

  • Delete packages/client/src/client/websocket.ts (74 lines)
  • Remove the re-export from packages/client/src/index.ts (1 line)
  • Remove ws imports and the ws:///wss:// branch from scripts/cli.ts (internal dev CLI)
  • Add migration guidance to docs/migration.md and docs/migration-SKILL.md
  • Add a changeset marking a major bump for @modelcontextprotocol/client

Security risks

None. This PR only removes code and adds documentation. No new logic, no auth changes, no user input handling changes.

Level of scrutiny

Low scrutiny warranted. The code changes are purely deletions — removing a file, removing export/import lines, removing a branch from an internal CLI. The migration documentation is thorough and accurate. The design decision to remove WebSocket transport was already made with maintainer consensus in issue #142.

Other factors

  • The two nit-level bugs found (leftover ws/@types/ws devDependencies, and ws:// URLs falling through to StdioClientTransport in the internal CLI) are valid but minor cleanup items that don't affect correctness or any public API surface.
  • All tests pass per the PR description (311 tests, typecheck, lint, build).
  • The changeset correctly marks this as a major bump since it removes a public export.

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean removal with proper migration docs, dependency cleanup, and helpful error for ws:// URLs.

Extended reasoning...

Overview

This PR removes WebSocketClientTransport from @modelcontextprotocol/client, deleting the implementation file (packages/client/src/client/websocket.ts), its re-export from packages/client/src/index.ts, and the ws/@types/ws devDependencies from package.json, pnpm-workspace.yaml, and pnpm-lock.yaml. The internal CLI (scripts/cli.ts) is updated to throw a clear error for ws:// URLs. Migration docs are updated in both docs/migration.md and docs/migration-SKILL.md.

Security risks

None. This PR removes code rather than adding it, and does not touch auth, crypto, or permissions.

Level of scrutiny

Low scrutiny warranted. This is a straightforward deletion of a transport class with no complex logic changes. The only new code is a single throw new Error(...) line in an internal CLI script. The breaking change is properly marked with a major changeset.

Other factors

  • Both prior nit-level comments from my previous review are already addressed in the current PR diff (dead deps removed, explicit ws:// error added).
  • No bugs found by the bug hunting system.
  • Tests pass per the PR description.
  • Migration documentation is thorough and covers both human-readable and LLM-optimized formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing WebSocketServerTransport?

1 participant